﻿<navigation:Page x:Class="Arch.Samples.RiaServices.Views.SubCategories.SubCategoryList" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:local="clr-namespace:Arch.Samples.RiaServices.Controls" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" xmlns:helper="clr-namespace:Arch.Samples.RiaServices.Helpers" d:DesignWidth="640" d:DesignHeight="480"
    Title="Sub Categories">
    <navigation:Page.Resources>
        <helper:DataContextProxy x:Key="ContextProxy" />
    </navigation:Page.Resources>
    <local:BusyIndicator x:Name="busyIndicator" IsBusy="{Binding Context.IsBusy}">
        <tk:DockPanel x:Name="LayoutRoot">
            <ContentControl tk:DockPanel.Dock="Top" ContentTemplate="{StaticResource NoEditAdminButtons}" Content="{Binding}" />
            <!--<ContentControl ContentTemplate="{StaticResource Grid}" Content="{Binding}" />-->
            <ContentControl>
                <data:DataGrid x:Name="Grid" ItemsSource="{Binding CollectionViewSource.View}"  AutoGenerateColumns="False"
                       helper:DataGridMultipleSelection.SelectedItemsSource="{Binding SelectedItems}">
                    <data:DataGrid.Columns>
                        <data:DataGridTextColumn Header="Name" SortMemberPath="Name" Binding="{Binding Name}"/>
                        <data:DataGridTemplateColumn  Header="GlobalCategory" SortMemberPath="GlobalCategory.Name">
                            <data:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <ComboBox SelectedItem="{Binding Path=GlobalCategory,Mode=TwoWay}" 
                                              ItemsSource="{Binding Source.Categories, Source={StaticResource ContextProxy}}"></ComboBox>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellEditingTemplate>
                        </data:DataGridTemplateColumn>
                    </data:DataGrid.Columns>
                </data:DataGrid>
            </ContentControl>
            
            
        </tk:DockPanel>
    </local:BusyIndicator>
</navigation:Page>
